import request from '../../utils/request'

/**
 * 新增港口
 *
 */
export async function addPort(data) {
    return request(apiPath.mc + "/api/port", {
        method: 'post',
        data
    });
}


/**
 * 修改港口
 *
 */
export async function updatePort(data) {
    return request(apiPath.mc + "/api/port", {
        method: 'put',
        data
    });
}

/**
 * 删除港口
 *
 */
export async function deleteById({ id }) {
    return request(apiPath.mc + "/api/port/" + id, {
        method: 'delete'
    });
}

/**
 *根据id获取港口
 *
 */
export async function getById({ id }) {
    return request(apiPath.mc + "/api/port/" + id, {
        method: 'get'
    });
}

/**
     * 根据ids获取港口
     *
     * @param ids
     * @return
     */
export async function getByIds({ ids }) {
    return request(apiPath.mc + "/api/ports/" + ids, {
        method: 'get'
    })
}

/**
 * 分页获取港口列表
 *
 */
export async function getListForPage({ portCode, portName, portType, businessType, page }) {
    return request(apiPath.mc + "/api/port", {
        method: 'get',
        data: { portCode, portName, portType, businessType, page: page.page, size: page.size }
    });
}

/**
 * 港口top10下拉列表
 *
 * @param portType
 * @param name
 * @return
 */
export async function getTopTenPorts(data) {
    return request(apiPath.mc + "/api/port/top10", {
        method: 'get',
        data
    });
}

/**
 * 查找港口全部数据
 *
 * @param portType
 * @param name
 * @return
 */
export async function getListByCodeAndNameAndBusinessType(data) {
    return request(apiPath.mc + "/api/port/nameType", {
        method: 'get',
        data
    });
}